package org.jix.weblog.module.admin.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jix.weblog.module.admin.model.vo.user.UpdateAdminUserPasswordReqVO;
import org.jix.weblog.module.admin.service.AdminUserService;
import org.jix.weblog.module.common.aspect.ApiOperationLog;
import org.jix.weblog.module.common.utils.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version 1.0
 * @Author Jix
 * @Date 2024/7/29 9:17
 * @注释
 */

@RestController
@RequestMapping("/admin")
@Slf4j
@Api(tags = "admin用户模块")
public class AdminUserController {

    @Autowired
    private AdminUserService userService;

    @PostMapping("/password/update")
    @ApiOperation(value = "修改用户密码")
    @ApiOperationLog(description = "修改用户密码")
    public Response updatePassword(@RequestBody @Validated UpdateAdminUserPasswordReqVO reqVO) {
        return userService.updatePassword(reqVO);
    }

    @PostMapping("/user/info")
    @ApiOperation(value = "获取用户信息")
    @ApiOperationLog(description = "获取用户信息")
    public Response fingUserInfo(){
        return userService.findUserInfo();
    }
}
